#include "Angle.h"

Angle::Angle(const float& radian){
	val = radian;
}
Angle::~Angle(){

}

Angle Angle::FromDegree(const float& degree){
	return Angle(degree/180.0f*PI);
}

Angle& Angle::operator+(const Angle& other){
	val+=other.val;
	truncate();
	return (*this);
}

Angle& Angle::operator-(const Angle& other){
	val-=other.val;
	truncate();
	return (*this);
}

Angle& Angle::operator*(const float& scalar){
	val*=scalar;
	truncate();
	return (*this);
}

Angle& Angle::operator/(const float& scalar){
	val/=scalar;
	truncate();
	return (*this);
}

void Angle::truncate(){
	if (val>_2PI){
		val -= _2PI;
	}else if (val<0){
		val += _2PI;
	}
}
